<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 必须确保所有的请求都是成功的状态 
        // 只要有一个成功 就返回
        let p1 = Promise.reject('aaa');
        let p2 = Promise.resolve('bbb');
        let p3 = Promise.resolve('ccc');
        Promise.race([p1, p2, p3]).then(res => {
            console.log(res); // (3) ["aaa", "bbb", "ccc"]
        }).catch(err => {
            console.log('err', err); // err aaa
        })
    </script>
</body>

</html>